﻿Imports System.Text.RegularExpressions

Public Class frmMask
    Public strMask As String



    Sub New(ByVal typeData As String)

        '_typeData = typeData
        ' This call is required by the Windows Form Designer.
        InitializeComponent()

        ' Add any initialization after the InitializeComponent() call.

    End Sub

    Private Sub btnCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCancel.Click
        Me.Close()
    End Sub

    Private Sub btnAccept_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAccept.Click
        If ValidateMask() Then
            If rdbMayusculas.Checked Then
                strMask = ">"
            End If
            If rdbMinusculas.Checked Then
                strMask = "<"
            End If

            strMask = txtMask.Text
            Me.Close()
        Else
            Call MessageMistake("Por favor establesca la mascara correspondiente.")
        End If
    End Sub

    Private Sub txtMask_Validated(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtMask.Validated
        Dim reg As New Regex("@^([0]?[1-9]|[1][0-2]):([0-5][0-9]|[1-9]) [AP]M$") 'Hard Code
        'txtMaskTest.FormatProvider = reg
        strMask = txtMask.Text
        txtMaskTest.Mask = txtMask.Text
    End Sub

    Private Function ValidateMask() As Boolean
        If Trim(txtMask.Text) = "" Then
            Call MessageMistake("Por favor ingrese la mascara correspondiente.")
            Exit Function
        End If

        ValidateMask = True
    End Function

    Private Sub frmMask_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        txtMask.Text = strMask
        'Call MessageMistake(getTypeData)
    End Sub


End Class